package com.cscp.repository;

import com.cscp.entity.Consumer;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

@Repository
public interface ConsumerMethodRepository extends PagingAndSortingRepository<Consumer, Long> {

    List<Consumer> findByCustomerName(String customerName);

    List<Consumer> findByCustomerNameLike(String customerName);

    boolean existsByCustomerName(String customerName);

    @Transactional
    @Modifying
    int deleteByCustomerId(Long customerId);

}
